//
// Created by ASUS on 2024/10/14/星期一.
//

/*
 * 把 n 个人划分成 i 个非空集合的方案数（这 i 个集合没有顺序）
 */


#include <bits/stdc++.h>
using namespace std;

const int MOD = 1'000'000'007;
const int MX = 1001;
int s[MX][MX];

auto init = [] {
	s[0][0] = 1;
	for (int i = 1; i < MX; i++) {
		for (int j = 1; j <= i; j++) {
			s[i][j] = (s[i - 1][j - 1] + (long long) j * s[i - 1][j]) % MOD;
		}
	}
	return 0;
}();


int numberOfWays(int n, int x, int y) {
	long long ans = 0, perm = 1, pow_y = 1;
	for (int i = 1; i <= min(n, x); i++) {
		perm = perm * (x + 1 - i) % MOD;
		pow_y = pow_y * y % MOD;
		ans = (ans + perm * s[n][i] % MOD * pow_y) % MOD;
	}
	return ans;
}
